home *** CD-ROM | disk | FTP | other *** search
- Tutorial for c4a Crackme #1
- ---------------------------
-
- Written by Prophecy [tNO '98] on 5th August 1998.
- -------------------------------------------------
-
- [Note if there are things you don't quite understand email me at
- prophecy_@usa.net or catch me in EFNET in #cracking4newbies or #tno.]
-
- Well it become apparent very soon that this was a Visual Bullshit crackme,
- which crashed SmartCheck btw. You can do a bpx multibytetowidechar to
- break, and trace what happens with your string. I think VB is a bad language
- to trace in SoftIce especially for Newbies as VB moves your string around
- heaps and calls it's own functions etc which there is no nice API reference
- for etc... but anyway, once you remove the layers of VB the protection is
- (predicatably) very simple.
-
- Btw, if you are getting stuck trying to find the place where the XOR occurs,
- the line is 0x4032a0. First type "addr cm1" , then type bpx 4032a0. Softice
- will break when it reaches that line of code.
-
- Another thing is that tracing code is something that comes with experience,
- there is no quick and easy way and if c4a are reading this maybe their next
- crackme (for newbies) should be in C or something less bloated. Anyway, I
- think most ppl would find the tracing harder than the protection :)
-
- Your password is repeatedly XORED with '2000', eg if you entered as a code:
-
- 36 37 38 36 37 38 36 37 38
- xor with: 32 30 30 30 32 30 30 30 32
- --------------------------
- 04 07 08 06 05 08 06 07 0a
-
- At the end we have 04 07 08 06 05 08 06 07 0a (from above). This is
- compared to the string "qBQSYdXUe_B\V", so 678678678 is NOT the right
- password in this case :)
-
- but we know at the end your code must = qBQSY...
-
- thus : q B Q S Y d X U e _ B \ V (ascii character)
- 71 42 51 53 59 64 58 55 65 5f 42 5c 56 (hex value for ascii char)
-
- so (char1^0x32)=0x71, (char1=first char of password, ^ = XOR).
-
- we know that a ^ b = c and
- c ^ b = a thus
- a = c ^ b (btw a = c ^ b is the same as a = b ^ c)
-
- thus, let char1 = a, let 2 = b, and 0x71 = c,
-
- from above, a = c ^ b, thus char1 = 0x71 ^ 32, so
- char1 = (0x71 ^ 0x32) = 0x43 = 'C'
- similarly char2 = (0x42 ^ 0x30) = 0x72 = 'r'
- char3 = (0x51 ^ 0x30) = 0x61 = 'a'
- char4 = (0x53 ^ 0x30) = 0x63 = 'c'
- char5 = (0x59 ^ 0x32) = 0x6b = 'k'
- char6 = (0x64 ^ 0x30) = 0x54 = 'T'
- char7 = (0x58 ^ 0x30) = 0x68 = 'h'
- char8 = (0x55 ^ 0x30) = 0x65 = 'e'
-
- etc... as an exercise i'll leave it to you to work out the last 5 chars
- of the valid code.
-
- Incidentally, as with a LOT of VB apps, there is a quick (but braindead) way
- of finding your password. With VB5 there are 2 functions used to compare
- strings : __vbastrcmp and __vbastrcomp. I'm not saying ALL VB apps use
- these in their protections, just a lot :). This CrackMe uses __vbastrcomp.
-
- So do a "bpx __vbastrcomp". Softice will break. DON'T press F11 yet. First
- type DD ESP, which will show you what was pushed to the stack, ie what two
- strings are being compared. Typing dd esp will reveal this in SoftIce:
-
- xxxx:yyyyyyyy aaaaaaaa bbbbbbbb cccccccc dddddddd
-
- aaaaaaaa , as with all functions is the return address.
- the remaining 'bbbbbbbb' etc are the paramters the function is going to use.
- as it happens 'cccccccc' is the address of the good string, and 'dddddddd'
- is the address of your modified code (eg 04 07 08 06 05 08 06 07 0a if you
- entered 678678678). Typing "d cccccccc" in softice reveals the code that
- your modified code is going to be compared with which is: qBQSYdXUe_B\V.
- Because of the nature of this protection, if you type in "qBQSYdXUe_B\V" as
- the password, then bpx __vbastrcomp again, and this time type "d dddddddd",
- this will reveal the *real* code!
-
- Greetz:
- ------
-
- As usual, out to the #cracking4newbies crew. For a full list of my greetz
- see proph.home.ml.org
-
- Conclusion:
- ----------
-
- A trivial protection, however some good tips for newbies in this tut.
-
- -Prophecy.
-
- Veni Vedi Veci.
-